|
|
|
|
|
|
|
Now open the database AUTONUMB.MDB in Visdata. Open the tblSupervisors table and notice what happens to the AutoNumber field when you add a new record. A random number has been inserted in the AutoNumber field. (See Figure 20.12.) |
|
|
|
|
|
|
|
|
Figure 20.12.
The AutoNumber field becomes random after the Design Master is created. |
|
|
|
|
| |
|
|
|
|
The effects of database replication are not the only reason not to use AutoNumber fields in your application. The use of an AutoNumber, or Counter, field as a primary key in a data table should raise a red flag for the developer, indicating that the database is not properly constructed or normalized. AutoNumber fields should be used sparingly, if at all. |
|
|
|
|
|
|
|
|
|
|
Copies of the Design Master are referred to as replicas. We now modify the REPLDEMO.VBP project to create a copy of the REPLMAST.MDB file. |
|
|
|
|
|
|
|
|
If you need to, start Visual Basic 5 and load the REPLDEMO.VBP project. Add another command button to your form and name it cmdMakeReplica; insert the caption &Make Replica. |
|
|
|
|
|
|
|
|
Next, insert the code from Listing 20.3 into the cmdMakeReplica_Click event. |
|
|
|
|
|